enum dtype_tcm_pik_desc {
	TYPE(TCM_PIK_DESC)=0x3320
};
enum subtype_tcm_pik_desc {
	SUBTYPE(TCM_PIK_DESC,USERINFO)=0x1,
	SUBTYPE(TCM_PIK_DESC,CADATA),
	SUBTYPE(TCM_PIK_DESC,VERIFYDATA),
	SUBTYPE(TCM_PIK_DESC,PIKCERT),
	SUBTYPE(TCM_PIK_DESC,PCRQUOTE),
	SUBTYPE(TCM_PIK_DESC,KEYCERTIFY),
	SUBTYPE(TCM_PIK_DESC,CERTIFY_INFO)
};
typedef struct tcm_pik_desc_userinfo{
	char username[32];
	char user_role[32];
	BYTE node_uuid[32];
	char node_name[32];
	BYTE expand_digest[32];
	char * describe;
}__attribute__((packed)) RECORD(TCM_PIK_DESC,USERINFO);

typedef struct tcm_pik_desc_cadata{
	BYTE userinfo_uuid[DIGEST_SIZE];
	BYTE pikpub_uuid[DIGEST_SIZE];
	int certlen;
	BYTE * cert;
	int symmkey_len;
	BYTE * symmkey;
}__attribute__((packed)) RECORD(TCM_PIK_DESC,CADATA);

typedef struct tcm_pik_desc_verifydata{
	BYTE payload;
	BYTE userDigest[DIGEST_SIZE];
	BYTE pubDigest[DIGEST_SIZE];
	int signLen;
	BYTE * signData;
}__attribute__((packed)) RECORD(TCM_PIK_DESC,VERIFYDATA);

typedef struct tcm_pik_desc_pikcert{
	RECORD(TCM_PIK_DESC,USERINFO) userinfo;
	TCM_PUBKEY pikpub;
	RECORD(TCM_PIK_DESC,VERIFYDATA) verifydata;
}__attribute__((packed)) RECORD(TCM_PIK_DESC,PIKCERT);

typedef struct tcm_pik_desc_pcrquote{
	RECORD(TCM_PIK_DESC,USERINFO) userinfo;
	TCM_PCR_COMPOSITE pcrComp;
	BYTE nonce[32];
	int signLen;
	BYTE * signData;
}__attribute__((packed)) RECORD(TCM_PIK_DESC,PCRQUOTE);

typedef struct tcm_pik_desc_keycertify{
	RECORD(TCM_PIK_DESC,USERINFO) userinfo;
	int certify_data_size;
	BYTE * certify_data;
	TCM_PUBKEY pubkey;
	BYTE nonce[32];
	int signLen;
	BYTE * signData;
}__attribute__((packed)) RECORD(TCM_PIK_DESC,KEYCERTIFY);

typedef struct tcm_pik_desc_certify_info{
    TCM_STRUCT_VER version;
    TCM_KEY_USAGE keyUsage;             /* This SHALL be the same value that would be set in a
                                           TCM_KEY representation of the key to be certified. The
                                           upper byte MUST be zero */
    TCM_KEY_FLAGS keyFlags;             /* This SHALL be set to the same value as the corresponding
                                           parameter in the TCM_KEY structure that describes the
                                           public key that is being certified. The upper byte MUST
                                           be zero */
    TCM_AUTH_DATA_USAGE authDataUsage;  /* This SHALL be the same value that would be set in a
                                           TCM_KEY representation of the key to be certified */
    TCM_KEY_PARMS algorithmParms;       /* This SHALL be the same value that would be set in a
                                           TCM_KEY representation of the key to be certified */
    TCM_DIGEST pubkeyDigest;            /* This SHALL be a digest of the value TCM_KEY -> pubKey ->
                                           key in a TCM_KEY representation of the key to be
                                           certified */
    TCM_NONCE data;                     /* This SHALL be externally provided data.  */
    TCM_BOOL parentPCRStatus;           /* This SHALL indicate if any parent key was wrapped to a
                                           PCR */
    uint32_t PCRInfoSize;		/* This SHALL be the size of the pcrInfo parameter. A value
                                           of zero indicates that the key is not wrapped to a PCR */
    BYTE* PCRInfo;                      /* This SHALL be the TCM_PCR_INFO structure.  */
    /* NOTE: kgold - Added this structure, a cache of PCRInfo when not NULL */
}__attribute__((packed)) RECORD(TCM_PIK_DESC,CERTIFY_INFO);
